<?php

use App\Http\Controllers\Ai\AppController;
use App\Http\Controllers\Ai\BaiduController;
use App\Http\Controllers\ArticleCateController;
use App\Http\Controllers\ArticleContentController;
use App\Http\Controllers\AuthorController;
use App\Http\Controllers\AuthorFansController;
use App\Http\Controllers\BannerController;
use App\Http\Controllers\CategoryController;
use App\Http\Controllers\DocumentController;
use App\Http\Controllers\DocumentGroupController;
use App\Http\Controllers\EmoGroupController;
use App\Http\Controllers\EmoImageController;
use App\Http\Controllers\FileUploadController;
use App\Http\Controllers\ImageCategoryController;
use App\Http\Controllers\ImageCollectionController;
use App\Http\Controllers\ImageController;
use App\Http\Controllers\ImageItemController;
use App\Http\Controllers\ImageSeriesController;
use App\Http\Controllers\ImageShareController;
use App\Http\Controllers\LoginController;
use App\Http\Controllers\MenuController;
use App\Http\Controllers\RelationLinkController;
use App\Http\Controllers\SeriesController;
use App\Http\Controllers\SourceCategoryController;
use App\Http\Controllers\SourceController;
use App\Http\Controllers\SysConfigController;
use App\Http\Controllers\TemplateController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\UserProfessionController;
use App\Http\Controllers\UserScoreHistoryController;
use App\Http\Controllers\Video\VideoController;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;

Route::post("user/login", [LoginController::class, "login"]);
Route::get("user/overview", [UserController::class, "overview"]);
Route::prefix("user")->middleware(["auth"])->group(function (Router $router) {
    $router->get("info", [UserController::class, "info"]);
    $router->get("score", [UserController::class, "score"]);// TODO 上线之后移除该Api
    $router->put("update", [UserController::class, "update"]);
    $router->get("profession/list", [UserProfessionController::class, "index"]);
    $router->get("score/history", [UserScoreHistoryController::class, "index"]);
    $router->post("score/add", [UserScoreHistoryController::class, "add"]);
    $router->get("image/share", [UserController::class, "share"]);
    $router->get("image/collection", [UserController::class, "collection"]);
    $router->get("author/attention", [UserController::class, "attention"]);
});

Route::prefix("author")->middleware(["auth"])->group(function (Router $router) {
    $router->get("state", [AuthorController::class, "audit"]);
    $router->post("publish_wall_paper", [AuthorController::class, "publishWallPaper"]);
    $router->get("info", [AuthorController::class, "info"]);
    $router->post("update", [AuthorController::class, "update"]);
    $router->post("file/upload", [FileUploadController::class, "upload"]);
    $router->get("current_week", [AuthorController::class, "currentWeek"]);
    $router->get("total_data", [AuthorController::class, "totalData"]);
    $router->post("attention", [AuthorFansController::class, "create"])->middleware(["auth"]);
    $router->get("fans/list", [AuthorController::class, "fansList"]);
    $router->get("collection/list", [AuthorController::class, "collectionList"]);
    $router->get("share/list", [AuthorController::class, "shareList"]);
});

Route::get("app/ai/list", [AppController::class, "index"]);
Route::prefix("ai")->middleware(["auth"])->group(function (Router $router) {
    $router->post("baidu/image_process", [BaiduController::class, "imageProcess"]);
    $router->post("baidu/recognition", [BaiduController::class, "recognition"]);
    $router->post("video/crawler", [VideoController::class, "crawler"]);
});

Route::prefix("open")->group(function (Router $router) {
    $router->get("author/info", [AuthorController::class, "getInfo"]);
});

Route::prefix("banner")->group(function (Router $router) {
    $router->get("list", [BannerController::class, "list"]);
});

Route::prefix("img")->group(function (Router $router) {
    $router->get("series", [SeriesController::class, "list"]);
    $router->get("list", [ImageController::class, "index"]);
    $router->get("item", [ImageItemController::class, "list"]);
    $router->get("show", [ImageController::class, "show"]);
    $router->get("content", [ImageController::class, "content"]);
    $router->get("category", [CategoryController::class, "index"]);
    $router->get("category_all", [ImageCategoryController::class, "index"]);
    $router->get("series_all", [ImageSeriesController::class, "index"]);
    $router->post("download", [ImageItemController::class, "download"])->middleware(["auth"]);
    $router->post("collection", [ImageCollectionController::class, "collection"])->middleware(["auth"]);
    $router->post("share", [ImageShareController::class, "share"]);
});

Route::prefix("emo")->group(function (Router $router) {
    $router->get("group", [EmoGroupController::class, "index"]);
    $router->get("image", [EmoImageController::class, "index"]);
    $router->get("url", [EmoImageController::class, "url"]);
});

Route::prefix("file")->group(function (Router $router) {
    $router->post("upload", [FileUploadController::class, "upload"])->middleware(["auth"]);// 待删除
    $router->post("author", [FileUploadController::class, "uploadAuthor"])->middleware(["auth"]);
});

Route::prefix("doc")->group(function (Router $router) {
    $router->get("list", [DocumentController::class, "list"]);
    $router->get("show", [DocumentController::class, "show"]);
    $router->get("group", [DocumentGroupController::class, "list"]);
});

Route::prefix("menu")->group(function (Router $router) {
    $router->get("list", [MenuController::class, "index"]);
});

Route::prefix("source")->group(function (Router $router) {
    $router->get("category", [SourceCategoryController::class, "index"]);
    $router->get("item", [SourceController::class, "index"]);
    $router->get("detail", [SourceController::class, "show"]);
    $router->get("link", [RelationLinkController::class, "index"]);
});

Route::prefix("config")->group(function (Router $router) {
    $router->get("state", [SysConfigController::class, "show"]);
});

Route::prefix("msg")->group(function (Router $router) {
    $router->post("template/subscribe", [TemplateController::class, "subscribe"])->middleware(["auth"]);
});

Route::prefix("article")->group(function (Router $router) {
    $router->get("cate/all", [ArticleCateController::class, "all"]);
    $router->get("content", [ArticleContentController::class, "content"]);
    $router->get("list", [ArticleContentController::class, "list"]);
});
